package cn.tannn.ops.nginx.entity.converter;

import cn.tannn.ops.common.constant.CloudEnums;
import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;

/**
 * CloudEnums
 *
 * @author <a href="https://t.tannn.cn/">tan</a>
 * @version V1.0
 * @date 2024/8/23 上午10:51
 */
@Converter(autoApply = true)
public class CloudEnumsConverter implements AttributeConverter<CloudEnums,String> {
    @Override
    public String convertToDatabaseColumn(CloudEnums attribute) {
        return attribute.getName();
    }

    @Override
    public CloudEnums convertToEntityAttribute(String name) {
        return CloudEnums.fromName(name);
    }
}
